﻿<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"/>
    <!-- layui.css -->
    <script th:src="@{/js/jquery-2.2.4.min.js}"></script>
    <script th:src="@{/js/workutil.js}"></script>
    <link th:href="@{/plugin/layui/css/layui.css}" rel="stylesheet"/>
    <link th:href="@{/css/layui_custom.css}" rel="stylesheet"/>
</head>
<body>
<div class="">
    <!--内容区域 ajax获取-->
    <table class="layui-table" lay-data="{height:'full-20', url:'../setting/list', page:true,pageauto:true, id:'setting-table'}"
           lay-filter="setting-table">
        <thead>
        <tr>
            <th lay-data="{field:'title'}">标题</th>
            <th lay-data="{field:'name',  sort: true}">Name</th>
            <th lay-data="{field:'value'}">Value</th>
            <th lay-data="{fixed: 'right', width:80, align:'center', toolbar: '#barSetting'}"></th>
        </tr>
        </thead>
    </table>
</div>

<script type="text/html" id="barSetting">
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
</script>

<script th:src="@{/plugin/layui/layui.js}"></script>
<script type="text/javascript">
    layui.define(['table'], function (exports) {
        var table = layui.table;
        //监听工具条
        table.on('tool(setting-table)', function (obj) {
            var data = obj.data;
            if (obj.event === 'edit') {
                workUtils.put("name", data.name);
                workUtils.open({url: "../web/admin/settingedit.html", title: "修改配置"}, function () {
                    table.reload("setting-table");
                });
            }
        });
    });
</script>
</body>
</html>